package org.viettan.android.main.model;

import com.google.common.base.Preconditions;

/**
 * The {@code Section} is an article category (a section on the website).
 */
@SuppressWarnings("serial")
public class Section implements Entity {

    private int id;
    private String title;

    /**
     * Constructs a new {@code Section}.
     */
    public Section() {
    }

    /**
     * Returns the ID of the section
     */
    public int getId() {
	return id;
    }

    /**
     * Sets the ID of the section
     * 
     * @param id
     *            ID of the section
     */
    public Section setId(int id) {
	Preconditions.checkArgument(id > 0, "Id must be positive");

	this.id = id;
	return this;
    }

    /**
     * Returns the title of the section.
     */
    public String getTitle() {
	return title;
    }

    /**
     * Sets the Title of the section
     * 
     * @param title
     *            title of the section
     */
    public Section setTitle(String title) {
	this.title = title;
	return this;
    }

    @Override
    public String toString() {
	return title;
    }
}
